<!DOCTYPE html>
<html lang="zh-cn">
<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <meta name="description" content="">
  <meta name="author" content="">
  <link rel="icon" href="../../favicon.ico">
  <title>爱悦网_爱悦集团旗下网站</title>
  <link href="assets/css/bootstrap.min.css" rel="stylesheet">
  <link href="assets/css/play.css" rel="stylesheet">
  <link href="assets/css/offcanvas.css" rel="stylesheet">
  <link href="assets/css/style.css" rel="stylesheet">
  <script src="assets/js/jquery.min.js"></script>
  <script src="assets/js/ie8-responsive-file-warning.js"></script>
  <script src="assets/js/ie-emulation-modes-warning.js"></script>
  <script src="http://cdn.bootcss.com/html5shiv/3.7.2/html5shiv.min.js"></script>
  <script src="http://cdn.bootcss.com/respond.js/1.4.2/respond.min.js"></script>
</head>
﻿<body>
<?php require_once('./tpl/head.php'); 
require_once('./tpl/foot.php'); 
?>
<nav class="navbar navbar-fixed-top navbar-inverse">
  <div class="container-fluid">
    <div class="navbar-header">
      <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
        <span class="sr-only">Toggle navigation</span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
      </button>   
    </div>
    <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
      <?php
      require_once('system/dbConn.php');
      connect();
      $sql="select * from noveltype";
      $rs=mysql_query($sql)or die('查询 1 失败！'.mysql_error());
      ?>
      <ul class="nav navbar-nav">
        <li><a href="index.php">首页</a></li>
        <?php
        while($row=mysql_fetch_assoc($rs))
        {
          ?>
          <li><a href="list.php?tid=<?php
            echo $row["tid"];
            ?>
            "><?php
            echo $row["typename"];
            ?>
          </a></li>
          <?php
        }
        ?>
      </ul>   
      <form action="search.php" class="navbar-form navbar-left" role="search">
        <div class="form-group">
          <input type="text" class="form-control" name="foodname" placeholder="Search">
        </div>
        <button type="submit" class="btn btn-default">搜索</button>
      </form>
      <ul class="nav navbar-nav navbar-right">
        <li class="active"><a href="">欢迎<?php
          session_start();
          if(isset($_SESSION["user"]))
            echo " ".$_SESSION["user"]." ";
          else{
            echo "您";
          }
          ?>访问本网站</a>
        </li>
        <?php
        if(isset($_SESSION["user"]))
        {
          ?>
          <li><a href="logout.php">注销</a></li>
          <li class="dropdown">
            <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button"
            aria-haspopup="true" aria-expanded="false">个人中心 <span class="caret"></span></a>
            <ul class="dropdown-menu">
              <li><a href="#" data-toggle="modal" data-target="#changePassword">修改个人密码</a></li>
          <li><a href="#" data-toggle="modal" data-target="#changeInfor">修改个人信息</a></li>
          <li><a href="myCommentList.php?<?php echo'id='.$uid.''; ?> "  >我的评价</a></li>
             <li><a href="myCommentList.php?<?php echo'id='.$uid.''; ?> "  >我的书架</a></li>
              </ul>
            </li>
            <?php
          }else{
            ?>
            <li><a href="#" data-toggle="modal" data-target="#login">登录</a></li>
            <li><a href="#" data-toggle="modal" data-target="#reg">注册</a></li>
            <?php
          }
          ?>  
        </ul>
      </div>
    </div>
  </nav>


 
<!-- 留言显示0 -->
<?php  


connect();
session_start();
$u=$_SESSION["user"];
$sql="select * from users where uname='$u' ";
$resul=mysql_query($sql) or die('查询失败！'.mysql_error());
$ro=mysql_fetch_assoc($resul);
$uid=$ro["uid"];


$sql="select * from bookshelf where uid='$uid'";
$result=mysql_query($sql);


$totalrows=mysql_num_rows($result);
$page=$_REQUEST['page'];
if(!isset($page))
$page=1;
$rowsperpage=2;
$start=($page-1)*$rowsperpage;
$sql.="limit {$start},{$rowsperpage}";
$result=mysql_query($sql) or die('查询失败！'.mysql_error());
if($totalrows)
  { echo  '<div class="container-fluid control-label col-md-12 "><h1 class="text-center" style="color:white;">书架</h1>
<table class="table  table-bordered">
 <tr class="info">
   <th>序号</th>
   <th>小说名称</th>
   <th>操作</th>
 </tr> ';
 while($row=mysql_fetch_assoc($result))
 {
  echo '<tr class="success">';
  foreach ($row as $k => $value)
  {
    if($k=='uid')
      continue; 
    elseif($k=='nid')
    {
      $sql2='select * from novels where nid="'.$value.'"';
      $result2=mysql_query($sql2);
      while($row2=mysql_fetch_assoc($result2))
        {foreach ($row2 as $ke => $value2)
          if($ke=='novelname')
            $value=$value2;}
        }

        echo '<td>'.$value.'</td>';
    }
      echo '<td><a href="bookshelfDelete.php?id='.$row['id'].'" onClick="return confirm(\'确定要删除吗？\');">删除</a></td>';
      echo '</tr>';
    }
    echo '</table>';
    if($rowsperpage>=$totalrows)
      $totalpages=1;
    else
      $totalpages=ceil($totalrows/$rowsperpage);
    echo '<nav><ul class="pager">';

    
    echo '</ul></nav>';
    
    // echo '<form method=post method="myCommentList.php" enctype="multipart/form-data" class="form-horizontal">
    // <div align="right" class="form-group">
    //   <div class="col-md-offset-11 col-md-1">
    //     <input  type="text" name="page" class="form-control"></div>
    //     <input type="submit" class="btn btn-success btn-xs" value="转到">
    //   </div>
    // </form>';
  }
  else    
    echo  '<h3 align="center" style="color:red;">您尚添加书架</h3><hr>';
  ?>
</div>
<script src="./assets/js/jquery.min.js"></script>
<script src="./assets/js/bootstrap.min.js"></script>
<script src="./assets/js/ie10-viewport-bug-workaround.js"></script>
<script src="./assets/js/offcanvas.js"></script>
<script>
  $('.carousel').carousel({
        interval: 3000 
      })
    </script>
  </body>
  </html>
